package com.http;


import com.bean.AreaCode;
import com.bean.BankAccountAndPayChannel;
import com.bean.BankBranchData;
import com.bean.BankCodeData;
import com.bean.Banner;
import com.bean.BaseResponse;
import com.bean.CountyAreaCode;
import com.bean.HuiKaAreaCodeResponse;
import com.bean.HuiKaBankBranchCodeData;
import com.bean.HuiKaBankCodeData;
import com.bean.IndustryCategories;
import com.bean.MsAreaCode;
import com.bean.MsContactType;
import com.bean.UserInfo;
import com.bean.UserWallet;
import com.bean.VipLevel;
import com.woke.data.BankCard;
import com.woke.data.BusinessCategory;
import com.woke.data.Category;
import com.woke.data.ExchangeType;
import com.woke.data.UnionPayChannel;
import com.woke.data.UserPromoteCode;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;

/**
 * 作者 ： 林凤河
 * 创建时间：2016/9/21
 * 备注：@Field  ，@FieldMap :Post方式传递表单时，需要添加@FormUrlEncoded表示表单提交
 */

public interface ApiInterface {
//    //上传身份证
    @Multipart
    @POST("index.php?g=Api&m=Turui&a=upload_idCard")
    Call<String> upIdCard(@Part() List<MultipartBody.Part> params, @PartMap Map<String, RequestBody> map);

    //1.2登录
    @FormUrlEncoded
    @POST("index.php?g=api&m=user&a=login")
    Observable<BaseResponse<UserInfo>> login(@FieldMap Map<String, String> map);

    // 我的钱包 根据登录账号查询
    @FormUrlEncoded
    @POST("index.php?g=api&m=user&a=wallet")
    Observable<BaseResponse<UserWallet>> userWallet(@Field("username") String username);

    //1.42 广告栏目
    @GET("index.php?g=api&m=Ads&a=adsList")
    Observable<BaseResponse<List<Banner>>> getBannerList(@Query("oem_id") int oem_id);

    //1.43 我的银行卡
    @FormUrlEncoded
    @POST("index.php?g=api&m=BankList&a=getBankList")
    Observable<BaseResponse<List<BankCard>>> getBankCardList(@Field("userid") int userid);

    //1.43 我的银行卡（充值卡和到账卡）
    @FormUrlEncoded
    @POST("index.php?g=api&m=BankList&a=listKindCard")
    Observable<BaseResponse<List<BankCard>>> getBankCardList(@Field("user_id") int userid, @Field("kind") int kind);

    //获取渠道和银行卡列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=getMergeGallBank")
    Observable<BaseResponse<BankAccountAndPayChannel>> getBankAccountAndUnionPayChannel(@Field("userid") int userid, @Field("type") int type, @Field("kind") int kind);

    //获取渠道
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=getGallery")
    Observable<BaseResponse<List<UnionPayChannel>>> getPayChannel(@Field("userid") int userid, @Field("type") int type, @Field("kind") int kind);

    //1.16实名认证
    @Multipart
    @POST("index.php?g=api&m=ump&a=idAuth")
    Observable<BaseResponse> idAuth(@Part() List<MultipartBody.Part> params, @PartMap Map<String, RequestBody> map);

    //3.1中交所
    @FormUrlEncoded
    @POST("index.php?g=api&m=org&a=orgList")
    Observable<BaseResponse<List<UserPromoteCode>>> exchangeOrgList(@Field("type") int type);

    // 3.4信用卡提现 @POST("index.php?g=api&m=Nvpay&a=push")
    @FormUrlEncoded
    @POST("index.php?g=api&m=batchpay&a=push")
    Observable<BaseResponse> cashAdvance(@Field("user_id") int user_id, @Field("amount") float amount, @Field("name") String name, @Field("card_no") String card_no, @Field("way") int way);


    //3.5判断银行卡是否已经绑定
    @FormUrlEncoded
    @POST("index.php?g=api&m=Nvpay&a=isBinded")
    Observable<BaseResponse> isBindedBankAccount(@Field("user_id") int user_id, @Field("way") int way, @Field("card_no") String card_no);

    //3.6绑定卡
    @FormUrlEncoded
    @POST("index.php?g=api&m=Nvpay&a=binding")
    Observable<BaseResponse<String>> bindingBankAccount(@Field("user_id") int user_id, @Field("way") int way, @Field("card_no") String card_no);

    // 3.7充值  vipLevel登记以数据库为主
    @FormUrlEncoded
    @POST("index.php?g=api&m=Nvpay&a=pull")
    Observable<BaseResponse> recharge(@Field("user_id") int user_id, @Field("amount") float amount, @Field("way") int way, @Field("vipLevel") int vipLevel, @Field("card_no") String card_no);

    //3.8 商户入驻信息
    @FormUrlEncoded
    @POST("index.php?g=api&m=Merchant&a=getMerchantApi")
    Observable<BaseResponse<Integer>> getMerchantApi(@Field("userId") int userId);

    //3.9 商户信息的支付类型列表
    @FormUrlEncoded
    @POST("index.php?g=api&m=Merchant&a=getPayway")
    Observable<BaseResponse<List<BusinessCategory>>> getPayway(@Field("userId") int userId);

    //3.91 payWay 1微信 2支付宝  经营栏目
    @GET("index.php?g=api&m=Scancode&a=getCategory")
    Observable<BaseResponse<List<Category>>> getBusinessCategory(@Query("payWay") int payWay);

    //3.10 提交商户入驻信息
    @FormUrlEncoded
    @POST("index.php?g=api&m=Merchant&a=merchantInfo")
    Observable<BaseResponse> merchantInfo(@FieldMap Map<String, String> map);


    //3.11开通通道并入驻  gallery 入驻通道 字符串逗号，隔开 如3,2,45
    @FormUrlEncoded
    @POST("index.php?g=api&m=Merchant&a=enableGallery")
    Observable<BaseResponse<String>> openChannelAndActivateSerierNo(@Field("userId") int userId, @Field("serialNumber") String serialNumber, @Field("gallery") String gallery);

    //3.14激活商家收款码
//	@Headers("User-Agent:88chinapay")
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=bindGatheringCode")
    Observable<BaseResponse<String>> activateSeriesNo(@Field("userId") int userid, @Field("serialNumber") String serialNumber);


    //3.15全部类型的的 收款码通道
    //获取已开通的全部类型的收款通道接口(收款码专用)
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=getGatGall")
    Observable<BaseResponse<List<UnionPayChannel>>> getMerchatCollectionChannel(@Field("userId") int userId, @Field("serialNumber") String serialNumber);

    //3.16商家收款码 (咱不用) (注:代替原来的收款码g=Api&m=Scancode&a=paymentCode)
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=getPayCodePath")
    Observable<BaseResponse<String>> businessSeriesNo(@Field("userId") int userid);

    //3.17 新增通道  返回 serialNumber 然后调用3.15接口激活
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Gallery&a=newEnterGall")
    Observable<BaseResponse<String>> newEnterGall(@Field("userId") int userId);

    //3.18 汇卡入驻省份列表
    @GET("index.php?g=Api&m=Icloudful&a=getPosAreaCode")
    Observable<BaseResponse<HuiKaAreaCodeResponse>> getHuiKaProvinceAreaCode();

    //3.19 汇卡 城市列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Icloudful&a=getPosAreaCode")
    Observable<BaseResponse<HuiKaAreaCodeResponse>> getHuiKaCityAreaCode(@Field("code") String p_code, @Field("page") int page);

    //3.20	广东汇卡--获取银行总行ID
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Icloudful&a=getTotalIdOrBankNo")
    Observable<BaseResponse<HuiKaBankCodeData>> getHuiKaBankList(@Field("page") int page, @Field("name") String bankName);

    @FormUrlEncoded
    @POST("index.php?g=Api&m=Icloudful&a=getTotalIdOrBankNo")
    Observable<BaseResponse<HuiKaBankBranchCodeData>> getHuiKaBranchBankList(@Field("bankPid") int bankPid, @Field("page") int page, @Field("bankname") String bankName);

    //3.40 汇卡 商户入驻
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Icloudful&a=merchantSettled")
    Observable<BaseResponse> huiKaiMerchantsEnter(@FieldMap Map<String, String> map);

    //3.43 广州汇卡 判断是否需要重新提交 商户入驻信息
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Icloudful&a=isSettled")
    Observable<BaseResponse> isSettled(@Field("userId") int userId, @Field("way") int way);

    //3.23 入驻列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Merchant&a=gallery_list")
    Observable<BaseResponse<List<UnionPayChannel>>> gallery_list(@Field("userId") int userId);

    //3.24 通道入驻
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Merchant&a=merchantSettledApi")
    Observable<BaseResponse> merchantSettledApi(@Field("userId") int userId, @Field("galleryWay") int galleryWay);

    //注：旧商家收款码  (注:代替原来的收款码g=Api&m=Scancode&a=paymentCode)
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Scancode&a=paymentCode")
    Observable<BaseResponse<String>> oldBusinessSeriesNo(@Field("userid") int userid);

    //3.26众安车险
    @FormUrlEncoded
    @POST("index.php?g=Api&m=ZhongAn&a=fetchDirectUrl")
    Observable<BaseResponse<String>> fetchDirectUrl(@Field("userId") int userId);

    //3.27获取中交所类型列表
    @GET("index.php?g=Api&m=Org&a=getType")
    Observable<BaseResponse<List<ExchangeType>>> getExchangeType();

    //3.29 获取浦发 行业类别
    @GET("index.php?g=Api&m=GPu&a=getIndustr")
    Observable<BaseResponse<List<IndustryCategories>>> getIndustryCategories();

    //3.30浦发入驻省份列表
    @GET("index.php?g=Api&m=GPu&a=getPosAreaCode")
    Observable<BaseResponse<List<AreaCode>>> getProvinceAreaCode();

    //3.31浦发入驻市列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=getPosAreaCode")
    Observable<BaseResponse<List<AreaCode>>> getCityAreaCode(@Field("province_no") String province_no);

    //3.46 广州浦发--获取县级编码及名称
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=getCountyCode")
    Observable<BaseResponse<List<CountyAreaCode>>> getCountyCode(@Field("city_no") String city_no);

    //3.32 浦发开户总行列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=getBankList")
    Observable<BaseResponse<BankCodeData>> getBankList(@Field("page") int page, @Field("bankName") String bankName);

    //3.33 浦发开户支行列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=getBranchAndLinenum")
    Observable<BaseResponse<BankBranchData>> getBranchAndLinenum(@Field("bankId") String bankId, @Field("page") int page, @Field("branch") String branch);

    //3.34 浦发提交商户信息
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=enter")
    Observable<BaseResponse> puFaMerchantsEnter(@FieldMap Map<String, String> map);

    //3.35 判断身份证正反面图片是否审核通过(浦发银行)
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=picFir")
    Observable<BaseResponse> idCardPhotoAuthState(@Field("userId") int userId);

    //3.36 浦发上传身份证正反面
    @Multipart
    @POST("index.php?g=Api&m=GPu&a=picSec")
    Observable<BaseResponse> picSec(@Part("") List<MultipartBody.Part> params, @PartMap Map<String, RequestBody> map);

    //3.37 	广州浦发--判断商户信息是否已入驻
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=ifEnter")
    Observable<BaseResponse> ifEnter(@Field("userId") int userId);

    //3.38 	广州浦发--开通支付通道
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=choosePayType")
    Observable<BaseResponse> openChoosePayType(@Field("userId") int userI, @Field("way") int way);

    //3.39 广州浦发--商户入驻信息提交后,至少需要20s,才后开通支付通道3.38(浦发规定)  返回unKnow 表示商户信息没提交过,或者审核不通过
    @FormUrlEncoded
    @POST("index.php?g=Api&m=GPu&a=ifEnoughTime")
    Observable<BaseResponse> ifEnoughTime(@Field("userId") int userId, @Field("way") int way);

    //3.41 用户可升等级列表
    @FormUrlEncoded
    @POST("index.php?g=Api&m=User&a=getVipLevel")
    Observable<BaseResponse<List<VipLevel>>> getVipLevel(@Field("userId") int userId);

    //3.42 用户升级新接口
    @FormUrlEncoded
    @POST("index.php?g=Api&m=User&a=memberUpApi")
    Observable<BaseResponse> memberUpApi(@Field("userId") int userId, @Field("viplevel") int viplevel);

    //3.44 民生  商户入驻新接口
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Cmbc&a=newSettled")
    Observable<BaseResponse> newSettled(@FieldMap Map<String, String> map);

    //3.47 民生  省市县
    @FormUrlEncoded
    @POST("index.php?g=Api&m=Cmbc&a=get_area_code")
    Observable<BaseResponse<List<MsAreaCode>>> getAreaCode(@Field("parentId") String parentId);

    //3.48民生  负责人类型
    @GET("index.php?g=Api&m=Cmbc&a=get_contact_type")
    Observable<BaseResponse<List<MsContactType>>> getContactType();

}
